home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
clib
/
sys
/
h
/
dev
< prev
next >
Wrap
Text File
|
1996-11-09
|
3KB
|
104 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/clib/sys/h/RCS/dev,v $
* $Date: 1996/10/30 21:58:59 $
* $Revision: 1.2 $
* $State: Rel $
* $Author: unixlib $
*
* $Log: dev,v $
* Revision 1.2 1996/10/30 21:58:59 unixlib
* Massive changes made by Nick Burret and Peter Burwood.
*
* Revision 1.1 1996/04/19 21:23:56 simon
* Initial revision
*
***************************************************************************/
#ifndef __SYS_DEV_H
#define __SYS_DEV_H
#ifndef __UNIXLIB_TYPES_H
#include <unixlib/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* This section is placed here to prevent the inclusion of <sys/unix.h>
and all those other #include files that are otherwise unnecessary. */
#define MAXFD 64
struct file
{
__dev_t dev; /* device */
int oflag; /* oflag */
struct file *dup; /* dup list */
__pid_t pid; /* pid of owner */
int r[6]; /* OS_File r0 -> r5 */
};
#define BADF(f) (!(((f) >= 0 && (f) < MAXFD) ? (__u->file[f].dup) : 0))
/* Proper start of <sys/dev.h>. */
#define NDEV 4
/* major device numbers */
#define DEV_RISCOS 0 /* RiscOS file system */
#define DEV_TTY 1 /* tty */
#define DEV_PIPE 2 /* UnixLib pipe() */
#define DEV_NULL 3 /* /dev/null */
struct dev
{
int (*open)(char *,int,struct file *);
int (*close)(int,struct file *);
int (*read)(int,void *,int,struct file *);
int (*write)(int,void *,int,struct file *);
__off_t (*lseek)(int,__off_t,int,struct file *);
int (*ioctl)(int,int,void *,struct file *);
};
extern struct dev __dev[NDEV];
#define major(x) ((x) >> 8)
#define minor(x) ((x) & 0xff)
#define makedev(x,y) (__dev_t)(((x) << 8) | ((y) & 0xff))
extern int __fsopen(char *,int,struct file *);
extern int __fsclose(int,struct file *);
extern int __fsread(int,void *,int,struct file *);
extern int __fswrite(int,void *,int,struct file *);
extern __off_t __fslseek(int,__off_t,int,struct file *);
extern int __fsioctl(int,int,void *,struct file *);
extern int __ttyopen(char *,int,struct file *);
extern int __ttyclose(int,struct file *);
extern int __ttyread(int,void *,int,struct file *);
extern int __ttywrite(int,void *,int,struct file *);
extern __off_t __ttylseek(int,__off_t,int,struct file *);
extern int __ttyioctl(int,int,void *,struct file *);
extern int __pipeopen(char *,int,struct file *);
extern int __pipeclose(int,struct file *);
extern int __piperead(int,void *,int,struct file *);
extern int __pipewrite(int,void *,int,struct file *);
extern __off_t __pipelseek(int,__off_t,int,struct file *);
extern int __pipeioctl(int,int,void *,struct file *);
extern int __nullopen(char *,int,struct file *);
extern int __nullclose(int,struct file *);
extern int __nullread(int,void *,int,struct file *);
extern int __nullwrite(int,void *,int,struct file *);
extern __off_t __nulllseek(int,__off_t,int,struct file *);
extern int __nullioctl(int,int,void *,struct file *);
#ifdef __cplusplus
}
#endif
#endif